# $Id$
# Maintainer: Giovanni Scafora <giovanni@archlinux.org>
# Contributor: Andrew Simmons <andrew.simmons@gmail.com>
# Contributor: György Balló <ballogy@freestart.hu>

pkgname=gparted
pkgver=0.29.0
pkgrel=2
pkgdesc="A Partition Magic clone, frontend to GNU Parted"
arch=('i686' 'x86_64')
url="http://gparted.sourceforge.net"
license=('GPL')
depends=('parted' 'gtkmm')
makedepends=('intltool' 'pkg-config' 'gnome-doc-utils')
optdepends=('dosfstools: for FAT16 and FAT32 partitions'
            'jfsutils: for jfs partitions'
            'f2fs-tools: for Flash-Friendly File System'
            'btrfs-progs: for btrfs partitions'
            'exfat-utils: for exFAT partitions'
            'ntfs-3g: for ntfs partitions'
            'reiserfsprogs: for reiser partitions'
            'udftools: for UDF file system support'
            'xfsprogs: for xfs partitions'
            'nilfs-utils: for nilfs2 support'
            'polkit: to run gparted directly from menu'
            'gpart: for recovering corrupt partition tables'
            'mtools: utilities to access MS-DOS disks')
validpgpkeys=('BB09FFB87563FA2E1A22146817A6D3FF338C9570') # "Curtis Gedak <gedakc@gmail.com>"
source=("https://downloads.sourceforge.net/project/${pkgname}/${pkgname}/${pkgname}-${pkgver}/${pkgname}-${pkgver}.tar.gz"{,.sig}
        'org.archlinux.pkexec.gparted.policy'
        'gparted_polkit')
sha256sums=('2250bf6bb43687be149c2a95fbfe2f6f0215690e187179d5f733ae518fa7c3cd'
            'SKIP'
            'c9fcdc9e0e0ec1d309d964c9768f9060a31e744926240985069c5e24e5e81ded'
            '7b76a2f6708cdd788782206b59e2ebfc21122cc9c05ec2e3fa78bd1044c1e6d3')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  sed -i "s:@gksuprog@ @installdir@/gparted %f:@installdir@/gparted_polkit %f:g" gparted.desktop.in.in
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  ./configure --prefix=/usr \
              --sbindir=/usr/bin \
              --enable-online-resize \
              --enable-libparted-dmraid
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  make DESTDIR="${pkgdir}" install

  # Install policy file
  install -Dm644 "${srcdir}/org.archlinux.pkexec.gparted.policy" \
                 "${pkgdir}/usr/share/polkit-1/actions/org.archlinux.pkexec.gparted.policy"

  # Install launcher script
  install -m755 "${srcdir}/gparted_polkit" \
                "${pkgdir}/usr/bin/gparted_polkit"
}
